<?php
/*
**用户登录和退出
**log.php
*/
require_once('init.php');

if($action == 'in')
{
session_start();  
$cookietime = time() + 3600;
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$password   = isset($_POST['password']) ? md5($_POST['password']) : '';
$chekcode = isset($_POST['chekcode']) ? strtoupper(trim($_POST['chekcode'])) : '';

require_once('model/class.login.php');
$qiLogin = new qiLogin($DB);
$qiLogin->userLoginWeb($username,$password,$chekcode,$cookietime);

$xingTemplate->display('log');
}

if($action == 'out')
{
header("Content-Typy:text/html; Charset=utf-8");
setcookie('name',time()-1);
setcookie('password',time()-1);
redirect('index.php', 2, '退出登陆成功，3秒钟返回到首页!');
}

?>